﻿cbuffer cbPerObject
{
	float4x4 WorldViewProjection;	
	float4x4 WorldView;	
	float4x4 View;	
	float4x4 InverseProjection;
	float4x4 ViewToLightProjection;
	float4x4 ViewToLightView;
}

cbuffer cbGlobal
{
	int2 srcSize;
    float scale;
}

SamplerState SrcSampler
{
	Filter = MIN_MAG_POINT_MIP_LINEAR;
    AddressU = Clamp;
    AddressV = Clamp;
};

Texture2D srcTexture;

struct App2VS
{
	float3 pos : POSITION;
	float3 col : COLOR;
	float3 normal : NORMAL;
};
struct VS2PS
{
	float4 pos : SV_Position;
	float3 viewRay : TEXCOORD0;
};
struct PS2GPU
{
	float4 value : SV_Target0;
};

void vs(App2VS IN, out VS2PS OUT)
{
	OUT.pos = float4(IN.pos, 1); //pass through for quad/etc
}
void ps(VS2PS IN, out PS2GPU OUT)
{
	float2 uv = IN.pos / srcSize;


	OUT.value = srcTexture.Sample(SrcSampler, uv) * scale;
	//OUT.value = float4(1,1,1,1) == OUT.value;
	//OUT.value = shadowUv.x % 2 + shadowUv.y % 2;
	//OUT.value = totalRadiance;
}
technique10 Render
{
	pass P0
	{
		SetGeometryShader( 0 );
		SetVertexShader( CompileShader( vs_4_0, vs() ) );
		SetPixelShader( CompileShader( ps_4_0, ps() ) );
	}
}